<html>
<head>
<title>RSVP manager</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<h1>RSVP manager</h1>

{% if m %}
  <div class=message>{{ m }}</div>
{% endif %}

{% if not edit_id %}
<h2>Add new guest</h2>
{% else %}
<h2>Edit current guest</h2>
{% endif %} 

<form action="/admin/addguest" method="post">
  <table>
    {{ form.as_p }}
  {% if not edit_id %}
  <p><input type="submit" value="Add Guest"></p>
  {% else %}
  <p><input type="submit" value="Edit Guest"></p>
  <input type="hidden" name="edit_id" value="{{ edit_id }}">
  {% endif %}
</form>

<h2>Current guests ({{ total }} guests, {{ confirmed }} confirmed)</h2>
<table border=0 width=100%>
  <tr>
    <th>Name</th>
    <th>e-mail</th>
    <th>mailed?</th>
    <th>read?</th>
    <th>rsvp?</th>
    <th># extra</th>
  </tr>
{% for guest in guests %}
  <tr class="{% cycle 'odd' 'even' %}">
    <td><span class="name">{{ guest.name }} 
    (<a href="/admin/?edit_id={{ guest.key.name }}">Edit</a>) 
    (<a href="/admin/{{ guest.key.name }}/delete">Delete</a>)</span></td>
    <td><span class="email">{{ guest.email }}</span></td>
    {% if guest.mail_ts %}
    <td><span class="mailed_yes">Yes 
	(<a href="/admin/{{ guest.key.name }}/sendmail">Re-send</a>)</span></td>
    {% else %}
    <td><span class="mailed_no">No 
	(<a href="/admin/{{ guest.key.name }}/sendmail">Send</a>)</span></td>
    {% endif %}
    <td>
    {% if guest.read_ts %}
    <span class="read_yes">Yes
    {% else %}
    <span class="read_no">No
    {% endif %}
    (<a href="/guest/{{ guest.key.name }}/home">See page</a>)
    </span></td>
    {% if guest.rsvp_ts or guest.rsvp != 'No' %}
      <td><span class="rsvp_{{ guest.rsvp }}">{{ guest.rsvp }}</span></td>
    {% else %}
      <td><span class="rsvp_no_reply">No Reply</span></td>
    {% endif %}
    <td><span class="extra">{{ guest.extra_guests }}</span></td>
  </tr>
{% endfor %}
</table>
</body>
</html>
